import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STData } from '@delon/abc';
import { SPage } from '@shared/components/table-page/table-page.component';
import { _HttpClient } from '@delon/theme';
import { NzModalService } from 'ng-zorro-antd';
import { ApiService } from '@core/services/api';
import { PeopleDetailComponent } from '../person-info/people-detail/people-detail.component';

@Component({
  selector: 'app-focus-personnel',
  templateUrl: './focus-personnel.component.html',
  styles: []
})
export class FocusPersonnelComponent implements OnInit {
  @ViewChild('st', { static: false }) st: STComponent;
  config: SPage = {
    columns: [
      {
        index: 'id',
        title: '名单来源',
      },
      {
        index: 'infoName',
        title: '姓名',
        filter: {
          placeholder: '请输入姓名',
          type: 'string'
        }
      },
      {
        index: 'infoIdcardNumber',
        title: '证件号码',
        filter: {
          placeholder: '请输入证件号码',
          type: 'string'
        }
      },
      {
        index: 'infoMobile',
        title: '手机号码',
        /*filter: {
          placeholder: '请输入手机号',
          type: 'string'
        }*/
      },
      {
        index: 'houseAdress',
        title: '现居住地址',
        filter: {
          placeholder: '请输入房屋地址',
          type: 'string'
        }
      },
      /*{
        index: 'infoNativeAddress',
        title: '户籍所在地',
        filter: {
          placeholder: '请输入户籍所在地',
          type: 'string'
        }
      },*/
      {
        index: 'status',
        title: '关注人员类型',
        filter: {
          placeholder: '请选择人员类型',
          type: 'select',
          defatuts: '1',
          items:[
            {label:'现住人员',value: '1'},
            {label:'退租人员',value: '0'},
          ]
        }
      },
      {
        index: 'roomInTime',
        title: '详细原因',

        filter: {
          placeholder: '',
          type: 'string',
        }
      }
    ],
    showCheckBox: true,
    editBtn:[
      {title:'查看出入记录'}
    ],
    reqUrl: this.api.peopleInfo.focusPersonnel.url
  }
  constructor(private http: _HttpClient, private modal: NzModalService, private api: ApiService) { }

  ngOnInit() {

  }

  // 操作区
  operate(e): void {
    if (e.title === '查看详情') {
      this.previewDital(e.data);
    }
  }
  // 选择数据
  selectChange(e) {
    console.log(e);

  }

  /**
   * 查看详情
   * @param _param 人员详情
   */
  previewDital(_param): void {
    this.modal.create({
      nzTitle: '人员详情',
      nzWidth: 1000,
      nzContent: PeopleDetailComponent,
      nzComponentParams: {
        _param
      },
      nzFooter: null
    })
  }

}
